package com.xiaoKe.zhonghzu.ui.mine;
import android.os.CountDownTimer;
import android.view.View;
import com.xiaoKe.zhonghzu.R;
import com.xiaoKe.zhonghzu.databinding.FragmentPhonePasswordBinding;
import com.xiaoKe.zhonghzu.global.base.BaseFragment;

/**
 * @ProjectName : app
 * @Author : Shijingna
 * @Time : 2022/11/9 3:13 下午
 * @Description : 忘记密码
 */
public class PhonePasswordFragment extends BaseFragment<FragmentPhonePasswordBinding> implements View.OnClickListener {
    CountDownTimer countDownTimer;

    @Override
    protected void initView() {
       binding.code.setOnClickListener(this);
       binding.save.setOnClickListener(this);
    }

    @Override
    protected void initData() {
        countDownTimer = new CountDownTimer(60000, 1000) {
            @Override
            public void onTick(long millisUntilFinished) {
               binding.code.setTextColor(getResources().getColor(R.color.red));
               binding.code.setClickable(false);
               binding.code.setText("(" + millisUntilFinished / 1000 + ") "+getString(R.string.秒后重发));

            }

            @Override
            public void onFinish() {
               binding.code.setText(getString(R.string.重新发送验证码));
               binding.code.setClickable(true);
               binding.code.setTextColor(getResources().getColor(R.color.white));
            }
        };


    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        countDownTimer.cancel();
    }



    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.code:

                break;
            case R.id.save:

                break;
        }
    }

}
